﻿@model EditUserViewModel
@using Orchard.Users.ViewModels;

<h1>@RenderTitleSegments(T["Edit User"])</h1>

<div asp-validation-summary="ModelOnly"></div>
<form asp-action="Edit" method="post">
    <input type="hidden" asp-for="Id" />
    <div class="form-group" asp-validation-class-for="UserName">
        <label asp-for="UserName">@T["User name"]</label>
        <span asp-validation-for="UserName" class="text-danger">@T["The user name is required."]</span>
        <input asp-for="UserName" class="form-control" autofocus/>
    </div>
    <div class="form-group" asp-validation-class-for="Email">
        <label for="Email">@T["Email"]</label>
        <span asp-validation-for="Email" class="text-danger">@T["The email is invalid."]</span>
        <input asp-for="Email" class="form-control" type="email" />
    </div>
    <h6>@T["Roles"]</h6>
    <div class="form-group">
        @for (var i = 0; i < Model.Roles.Length; i++)
        {
            <div class="form-check">
                <label class="form-check-label" asp-for="Roles[i].IsSelected">

                    <input class="form-check-input" type="checkbox" asp-for="Roles[i].IsSelected" />
                    <input type="hidden" asp-for="Roles[i].Role" />
                    @Model.Roles[i].Role
                </label>
            </div>
        }
    </div>


    <fieldset>
        <div class="form-group">
            <button class="btn btn-primary" type="submit">@T["Save"]</button>
            <a class="btn btn-secondary" asp-route-action="Index">@T["Cancel"]</a>
        </div>
    </fieldset>
</form>
